from keras.models import load_model
import cv2
import numpy as np
from PIL import Image

model=load_model('model.h5')

def pre(path):
    src=Image.open(path)
    src=np.array(src)[...,::-1]
    src = cv2.resize(src, (64, 64))
    src = np.expand_dims(src, axis=0)
    src = (src / 255.0).astype('float32')
    out = model.predict(src)[0]
    index = np.argmax(out)
    return index


if __name__ == '__main__':
    out=pre('pdr_train/0/013b7c70-5e3b-42b7-86af-167815a5b04f___RS_HL 7480.JPG')
    print(out)
